package com.lavender.transaction.mapper;

import com.lavender.transaction.entity.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AccountMapper {

    @Select("select * from account where user_id = #{userId}")
    Account selectByUserId(Account account);

    @Update("update account set money = #{money} where user_id = #{userId}")
    int updateByUserId(Account account);

    @Delete("delete from account where user_id = #{userId}")
    int deleteByUserId(Account account);

    @Delete("delete from account")
    int deleteAll();

    @Insert("insert into account(user_id,account_num,money) values (#{userId},#{accountNum},#{money})")
    int insert(Account account);

}